import { request } from '@umijs/max';

/**
 * 登录
 * @param data
 * @returns
 */
export const loginAPI = (data: API_AUTH.LoginData) => {
  // 此处调接口
  return request('/auth/admin_login', {
    method: 'POST',
    data,
    // withCredentials: true, // 允许服务器端接口返回的时候写cookie到浏览器
  });
};

/**
 * 获取管理员信息
 * @returns
 */
export const currentUserAPI = () => {
  return request('/admin/managers/info', {
    // withCredentials: true,
  });
};

/**
 * 退出登录
 * @returns
 */
export const logOutAPI = () => {
  return request('/auth/manager_logout');
};
